<?php #Всплывающее окно

class modal_win extends Load_use
{
	private $printed=false;
	private $params_arr=array('width','height','title','cont','class','close_on');
	private $messages=false;
	function getBlock()
	{	
		if(!$this->printed)
		{
			$this->view->js('modal_win');
			$this->view->gText.='
			<div class="modal-win-wrapper _win_wrapper" id="modal_win_wrapper">
				<div id="modal_win_bg_click _win_close"></div>
				<div class="modal-win _win_block" id="modal_win">
					<div class="title ">
						<button class="_win_close" id="modal_win_close">X</button>
						<h3 id="modal_win_title" class="_win_title"></h3>
						<div class="clear"></div>
					</div>
					<div class="cont _win_content" id="modal_win_cont"></div>
				</div>
			</div>';
			$this->printed=true;
		}
		if(!empty($this->params))/*просто объявление */
		{			
			$btnId=$this->getParam('btn-id',false);
			if($btnId)$btnId='\'#'.$btnId.'\'';		
			$data=array();
			foreach($this->params_arr as $val)
			{
				if(isset($this->params[$val]))
					$data[$val=='class'?'t_class':$val]=$this->params[$val];
			}
			$this->view->js_on_load[]=' $('.$btnId.').modal_win('.getJSArr($data).','.(!$btnId?'true':'false').'); ';
		}
	}
}